package com.pengshun.modules.api.transport.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.pengshun.modules.api.coal.validator.First;
import com.pengshun.modules.api.coal.validator.Fourth;
import com.pengshun.modules.api.coal.validator.Second;
import com.pengshun.modules.api.coal.validator.Third;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;


@Data
@NoArgsConstructor
public class TransportSettlementDto {
	@NotNull(message = "transportSettlementId不能为空", groups = {Second.class, Third.class})
	private Long transportSettlementId;

	@ApiModelProperty(value = "分配数量")
	private BigDecimal allotNum;

	@ApiModelProperty(value = "实发数量")
	private BigDecimal mineHairNum;

	@ApiModelProperty(value = "到货数量")
	private BigDecimal arrivalNum;

	@ApiModelProperty(value = "接单价格")
	private BigDecimal takePrice;

	@ApiModelProperty(value = "发布价格")
	private BigDecimal issuePrice;
	private BigDecimal diffPrice;

	@ApiModelProperty(value = "总运费")
	private BigDecimal totalPrice;

	@ApiModelProperty(value = "盈利")
	@NotNull(message = "盈利不能为空", groups = {First.class})
	private BigDecimal profit;

	@ApiModelProperty(value = "货运id")
	@NotNull(message = "货运id不能为空", groups = {First.class})
	private Long transportId;

	@ApiModelProperty(value = "订单id")
	private Long orderId;

	@ApiModelProperty(value = "申请人id")
	private Long userId;
	private Long suerUserId;

	@ApiModelProperty(value = "1待结算2已结算3已拒绝")
	private Integer status;

	@ApiModelProperty(value = "申请时间")
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	private Date applyTime;

	@ApiModelProperty(value = "退回原因")
	@NotNull(message = "原因不能为空", groups = {Third.class})
	@Length(max = 50,message = "原因最多50个字",groups = {First.class,Third.class})
	private String casue;
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	private Date rejectTime;
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	private Date settleTime;

	private String orderNo;
	@Length(max = 50,message = "备注最多50个字",groups = First.class)
	private String remark;
	private String startAddress;
	private String endAddress;
	private String merchantName;
	private String transportName;
	private String settlementNo;
	private Long  orderAllotTransportId;
	public TransportSettlementDto(BigDecimal allotNum, BigDecimal mineHairNum, BigDecimal arrivalNum, BigDecimal takePrice, BigDecimal issuePrice, BigDecimal totalPrice,
								  BigDecimal profit,Long transportId,Long orderId,Long suerUserId,String orderNo, BigDecimal diffPrice) {
		this.allotNum = allotNum;
		this.mineHairNum = mineHairNum;
		this.arrivalNum = arrivalNum;
		this.takePrice = takePrice;
		this.issuePrice = issuePrice;
		this.totalPrice = totalPrice;
		this.profit = profit;
		this.transportId=transportId;
		this.orderId=orderId;
		this.suerUserId=suerUserId;
		this.orderNo=orderNo;
		this.diffPrice=diffPrice;
	}
}

